home *** CD-ROM | disk | FTP | other *** search
/ Team Palmtops 7 / Palmtops_numero07.iso / WinCE / SDKWindowsCE / HandHeldPCPro30 / sdk.exe / Jupiter SDK / data1.cab / MFC / src / occimpl.h < prev    next >
Encoding:
C/C++ Source or Header  |  1999-02-19  |  18.1 KB  |  504 lines

  1. // This is a part of the Microsoft Foundation Classes C++ library.
  2. // Copyright (C) 1992-1998 Microsoft Corporation
  3. // All rights reserved.
  4. //
  5. // This source code is only intended as a supplement to the
  6. // Microsoft Foundation Classes Reference and related
  7. // electronic documentation provided with the library.
  8. // See these sources for detailed information regarding the
  9. // Microsoft Foundation Classes product.
  10.  
  11. #ifndef _AFX_NO_OCC_SUPPORT
  12.  
  13. #if !defined(_WIN32_WCE)
  14. #include <oledb.h>
  15. #include "olebind.h"
  16. #include "ocdbid.h"
  17. #include "ocdb.h"
  18.  
  19. // MFC doesn't use the OLEDB 1.5 features of ATL and it causes
  20. // compile problems, so just make ATL think it's not version 1.5
  21. #if (OLEDBVER >= 0x0150)
  22. #undef OLEDBVER
  23. #define OLEDBVER 0x0100
  24. #endif 
  25.  
  26. #define AtlTrace AfxTrace
  27. #include "atldbcli.h"
  28.  
  29. class CDataSourceControl;
  30. class CDataBoundProperty;
  31.  
  32. // CCmdTarget
  33.     class COleControlContainer;
  34.     class COleControlSite;
  35.  
  36. class COccManager;
  37. struct _AFX_OCC_DIALOG_INFO;
  38.  
  39. #define DISPID_DATASOURCE   0x80010001
  40. #define DISPID_DATAFIELD    0x80010002
  41.  
  42. interface AFX_NOVTABLE IDataSourceListener : public IUnknown
  43. {
  44. public:
  45.     virtual HRESULT STDMETHODCALLTYPE OnDataMemberChanged(BSTR bstrDM) = 0;
  46.     virtual HRESULT STDMETHODCALLTYPE OnDataMemberAdded(BSTR bstrDM) = 0;
  47.     virtual HRESULT STDMETHODCALLTYPE OnDataMemberRemoved(BSTR bstrDM) = 0;
  48. };
  49.  
  50. interface AFX_NOVTABLE IDataSource : public IUnknown
  51. {
  52. public:
  53.     virtual HRESULT STDMETHODCALLTYPE GetDataMember(BSTR bstrDM, const GUID __RPC_FAR* riid, IUnknown __RPC_FAR* __RPC_FAR* ppunk) = 0;
  54.     virtual HRESULT STDMETHODCALLTYPE GetDataMemberName(long lIndex, BSTR __RPC_FAR *pbstrDM) = 0;
  55.     virtual HRESULT STDMETHODCALLTYPE GetDataMemberCount(long __RPC_FAR *plCount) = 0;
  56.     virtual HRESULT STDMETHODCALLTYPE AddDataSourceListener(IDataSourceListener __RPC_FAR *pDSL) = 0;
  57.     virtual HRESULT STDMETHODCALLTYPE RemoveDataSourceListener(IDataSourceListener __RPC_FAR *pDSL) = 0;
  58. };
  59.  
  60. /////////////////////////////////////////////////////////////////////////////
  61. // OLE Databinding support class for data sources
  62.  
  63. interface IRowPosition;
  64.  
  65. class CDataSourceControl
  66. {
  67. private:
  68.     CDataSourceControl() {};
  69. public:
  70.     struct METAROWTYPE
  71.     {
  72.         DBCOLUMNID idColumnID;
  73.         DWORD dwColumnID;
  74.         LPSTR lpstrName;
  75.         DWORD dwName;
  76.         CPtrList* m_pClientList;
  77.     };
  78.  
  79.     CDataSourceControl(COleControlSite *pClientSite);
  80.     ~CDataSourceControl();
  81.     HRESULT Initialize();
  82.     virtual IUnknown* GetCursor();
  83.     HRESULT GetMetaData();
  84.     virtual void BindProp(COleControlSite* pClientSite, BOOL bBind = TRUE);
  85.     virtual void BindProp(CDataBoundProperty* pProperty, BOOL bBind = TRUE);
  86.     virtual void BindColumns();
  87.     BOOL CopyColumnID(DBCOLUMNID* pcidDst, DBCOLUMNID const *pcidSrc);
  88.     HRESULT GetBoundClientRow();
  89.     virtual HRESULT UpdateControls();
  90.     virtual HRESULT UpdateCursor();
  91.     COleVariant ToVariant(int nCol); 
  92.  
  93.     COleControlSite *m_pClientSite;  // Back ptr to containing site
  94.     ICursorMove* m_pCursorMove;
  95.     ICursorUpdateARow* m_pCursorUpdateARow;
  96.     int m_nColumns;
  97.     METAROWTYPE* m_pMetaRowData;
  98.     CPtrList m_CursorBoundProps;
  99.     void* m_pVarData;
  100.     int m_nBindings;
  101.     DBCOLUMNBINDING *m_pColumnBindings;
  102.     VARIANT* m_pValues;
  103.     BOOL m_bUpdateInProgress;
  104.  
  105. // OLE/DB stuff
  106.     IDataSource*            m_pDataSource;
  107.     IRowPosition*           m_pRowPosition;
  108.     ATL::CRowset*           m_pRowset;
  109.     ATL::CDynamicAccessor*  m_pDynamicAccessor;
  110.  
  111.     DWORD m_dwRowsetNotify; // IRowsetNotify cookie
  112. };
  113.  
  114. /////////////////////////////////////////////////////////////////////////////
  115. // OLE Databinding support class for bound controls
  116.  
  117. class CDataBoundProperty
  118. {
  119. protected:
  120.     CDataBoundProperty() {};
  121. public:
  122.     CDataBoundProperty(CDataBoundProperty* pLast, DISPID dispid, WORD ctlid);
  123.     ~CDataBoundProperty() {};
  124.     void SetClientSite(COleControlSite *pClientSite);
  125.     void SetDSCSite(COleControlSite *pDSCSite);
  126.     void RemoveSource();
  127.     void Notify();
  128.     IUnknown* GetCursor();
  129.     CDataBoundProperty* GetNext();
  130.  
  131.     COleControlSite *m_pClientSite;  // Back ptr to containing site
  132.     WORD m_ctlid;
  133.     DISPID m_dispid;
  134.     COleControlSite *m_pDSCSite;
  135.     BOOL m_bOwnXferOut;
  136.     BOOL m_bIsDirty;
  137.     CDataBoundProperty* m_pNext;
  138. };
  139. #endif // _WIN32_WCE
  140.  
  141. /////////////////////////////////////////////////////////////////////////////
  142. // Control containment helper functions
  143.  
  144. DLGTEMPLATE* _AfxSplitDialogTemplate(const DLGTEMPLATE* pTemplate,
  145.     CMapWordToPtr* pOleItemMap);
  146.  
  147. void _AfxZOrderOleControls(CWnd* pWnd, CMapWordToPtr* pOleItemMap);
  148.  
  149. /////////////////////////////////////////////////////////////////////////////
  150. // COleControlContainer - implementation class
  151.  
  152. class COleControlContainer : public CCmdTarget
  153. {
  154. public:
  155. // Constructors/destructors
  156.     COleControlContainer(CWnd*  pWnd);
  157.     virtual ~COleControlContainer();
  158.  
  159. // Operations
  160.     BOOL CreateControl(CWnd* pWndCtrl, REFCLSID clsid,
  161.         LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, UINT nID,
  162.         CFile* pPersist=NULL, BOOL bStorage=FALSE, BSTR bstrLicKey=NULL,
  163.         COleControlSite** ppNewSite=NULL);
  164.    // Overload to allow creation of default-sized controls
  165.     BOOL CreateControl(CWnd* pWndCtrl, REFCLSID clsid,
  166.         LPCTSTR lpszWindowName, DWORD dwStyle, const POINT* ppt,
  167.       const SIZE* psize, UINT nID, CFile* pPersist=NULL, BOOL bStorage=FALSE,
  168.       BSTR bstrLicKey=NULL, COleControlSite** ppNewSite=NULL);
  169.     virtual COleControlSite* FindItem(UINT nID) const;
  170.     virtual BOOL GetAmbientProp(COleControlSite* pSite, DISPID dispid,
  171.         VARIANT* pvarResult);
  172.     void CreateOleFont(CFont* pFont);
  173.     void FreezeAllEvents(BOOL bFreeze);
  174.     virtual void ScrollChildren(int dx, int dy);
  175.     virtual void OnUIActivate(COleControlSite* pSite);
  176.     virtual void OnUIDeactivate(COleControlSite* pSite);
  177.  
  178.     virtual void CheckDlgButton(int nIDButton, UINT nCheck);
  179.     virtual void CheckRadioButton(int nIDFirstButton, int nIDLastButton,
  180.         int nIDCheckButton);
  181.     virtual CWnd* GetDlgItem(int nID) const;
  182.     virtual void GetDlgItem(int nID, HWND* phWnd) const;
  183.     virtual UINT GetDlgItemInt(int nID, BOOL* lpTrans, BOOL bSigned) const;
  184.     virtual int GetDlgItemText(int nID, LPTSTR lpStr, int nMaxCount) const;
  185.     virtual LRESULT SendDlgItemMessage(int nID, UINT message, WPARAM wParam,
  186.         LPARAM lParam);
  187.     virtual void SetDlgItemInt(int nID, UINT nValue, BOOL bSigned);
  188.     virtual void SetDlgItemText(int nID, LPCTSTR lpszString);
  189.     virtual UINT IsDlgButtonChecked(int nIDButton) const;
  190. #ifndef _AFXDLL
  191.     virtual void AttachControlSite(CWnd* pWnd);
  192. #else
  193.     void AttachControlSite(CWnd* pWnd);
  194. #endif
  195.  
  196. // Attributes
  197.     CWnd* m_pWnd;
  198.     CMapPtrToPtr m_siteMap;
  199.     COLORREF m_crBack;
  200.     COLORREF m_crFore;
  201.     LPFONTDISP m_pOleFont;
  202.     COleControlSite* m_pSiteUIActive;
  203.  
  204. public:
  205.     // Interface maps
  206.     BEGIN_INTERFACE_PART(OleIPFrame, IOleInPlaceFrame)
  207.         INIT_INTERFACE_PART(COleControlContainer, OleIPFrame)
  208.         STDMETHOD(GetWindow)(HWND*);
  209.         STDMETHOD(ContextSensitiveHelp)(BOOL);
  210.         STDMETHOD(GetBorder)(LPRECT);
  211.         STDMETHOD(RequestBorderSpace)(LPCBORDERWIDTHS);
  212.         STDMETHOD(SetBorderSpace)(LPCBORDERWIDTHS);
  213.         STDMETHOD(SetActiveObject)(LPOLEINPLACEACTIVEOBJECT, LPCOLESTR);
  214.         STDMETHOD(InsertMenus)(HMENU, LPOLEMENUGROUPWIDTHS);
  215.         STDMETHOD(SetMenu)(HMENU, HOLEMENU, HWND);
  216.         STDMETHOD(RemoveMenus)(HMENU);
  217.         STDMETHOD(SetStatusText)(LPCOLESTR);
  218.         STDMETHOD(EnableModeless)(BOOL);
  219.         STDMETHOD(TranslateAccelerator)(LPMSG, WORD);
  220.     END_INTERFACE_PART(OleIPFrame)
  221.  
  222.     BEGIN_INTERFACE_PART(OleContainer, IOleContainer)
  223.         INIT_INTERFACE_PART(COleControlContainer, OleContainer)
  224.         STDMETHOD(ParseDisplayName)(LPBINDCTX, LPOLESTR, ULONG*, LPMONIKER*);
  225.         STDMETHOD(EnumObjects)(DWORD, LPENUMUNKNOWN*);
  226.         STDMETHOD(LockContainer)(BOOL);
  227.     END_INTERFACE_PART(OleContainer)
  228.  
  229.     DECLARE_INTERFACE_MAP()
  230.     DECLARE_DISPATCH_MAP()
  231. };
  232.  
  233.  
  234. /////////////////////////////////////////////////////////////////////////////
  235. // COleControlSite - implementation class
  236.  
  237. #define VT_MFCFORCEPUTREF   0x8000  // force DISPATCH_PROPERTYPUTREF
  238.  
  239. class COleControlSite : public CCmdTarget
  240. {
  241. public:
  242. // Constructors/destructors
  243.     COleControlSite(COleControlContainer* pCtrlCont);
  244.     ~COleControlSite();
  245.  
  246. // Operations
  247.     HRESULT CreateControl(CWnd* pWndCtrl, REFCLSID clsid,
  248.         LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, UINT nID,
  249.         CFile* pPersist=NULL, BOOL bStorage=FALSE, BSTR bstrLicKey=NULL);
  250.    // Overload to allow creation of default-sized controls
  251.     HRESULT CreateControl(CWnd* pWndCtrl, REFCLSID clsid,
  252.         LPCTSTR lpszWindowName, DWORD dwStyle, const POINT* ppt,
  253.       const SIZE* psize, UINT nID, CFile* pPersist=NULL, BOOL bStorage=FALSE,
  254.       BSTR bstrLicKey=NULL);
  255.     virtual BOOL DestroyControl();
  256.     UINT GetID();
  257.     BOOL GetEventIID(IID* piid);
  258.     virtual HRESULT DoVerb(LONG nVerb, LPMSG lpMsg = NULL);
  259.     BOOL IsDefaultButton();
  260.     DWORD GetDefBtnCode();
  261.     void SetDefaultButton(BOOL bDefault);
  262.     void GetControlInfo();
  263.     BOOL IsMatchingMnemonic(LPMSG lpMsg);
  264.     void SendMnemonic(LPMSG lpMsg);
  265.     void FreezeEvents(BOOL bFreeze);
  266.  
  267.     virtual void InvokeHelperV(DISPID dwDispID, WORD wFlags, VARTYPE vtRet,
  268.         void* pvRet, const BYTE* pbParamInfo, va_list argList);
  269.     virtual void SetPropertyV(DISPID dwDispID, VARTYPE vtProp, va_list argList);
  270.     virtual void AFX_CDECL InvokeHelper(DISPID dwDispID, WORD wFlags, VARTYPE vtRet,
  271.         void* pvRet, const BYTE* pbParamInfo, ...);
  272.     virtual void GetProperty(DISPID dwDispID, VARTYPE vtProp, void* pvProp) const;
  273.     virtual void AFX_CDECL SetProperty(DISPID dwDispID, VARTYPE vtProp, ...);
  274.     virtual BOOL AFX_CDECL SafeSetProperty(DISPID dwDispID, VARTYPE vtProp, ...);
  275.  
  276.     virtual DWORD GetStyle() const;
  277.     virtual DWORD GetExStyle() const;
  278.     virtual BOOL ModifyStyle(DWORD dwRemove, DWORD dwAdd, UINT nFlags);
  279.     virtual BOOL ModifyStyleEx(DWORD dwRemove, DWORD dwAdd, UINT nFlags);
  280.     virtual void SetWindowText(LPCTSTR lpszString);
  281.     virtual void GetWindowText(CString& str) const;
  282.     virtual int GetWindowText(LPTSTR lpszStringBuf, int nMaxCount) const;
  283.     virtual int GetWindowTextLength() const;
  284.     virtual int GetDlgCtrlID() const;
  285.     virtual int SetDlgCtrlID(int nID);
  286.     virtual void MoveWindow(int x, int y, int nWidth, int nHeight,
  287.         BOOL bRepaint);
  288.     virtual BOOL SetWindowPos(const CWnd* pWndInsertAfter, int x, int y,
  289.         int cx, int cy, UINT nFlags);
  290.     virtual BOOL ShowWindow(int nCmdShow);
  291.     virtual BOOL IsWindowEnabled() const;
  292.     virtual BOOL EnableWindow(BOOL bEnable);
  293.     virtual CWnd* SetFocus();
  294. #if !defined(_WIN32_WCE)
  295.     virtual void EnableDSC();
  296.     virtual void BindDefaultProperty(DISPID dwDispID, VARTYPE vtProp, LPCTSTR szFieldName, CWnd* pDSCWnd);
  297.     virtual void BindProperty(DISPID dwDispId, CWnd* pWndDSC);
  298. #endif // _WIN32_WCE
  299.  
  300. // Overridables
  301.     virtual BOOL QuickActivate();
  302.  
  303. // Attributes
  304.     COleControlContainer* m_pCtrlCont;
  305.     HWND m_hWnd;
  306.     CWnd* m_pWndCtrl;
  307.     UINT m_nID;
  308.     CRect m_rect;
  309.     IID m_iidEvents;
  310.     LPOLEOBJECT m_pObject;
  311.     LPOLEINPLACEOBJECT m_pInPlaceObject;
  312.     LPOLEINPLACEACTIVEOBJECT m_pActiveObject;
  313.     COleDispatchDriver m_dispDriver;
  314.     DWORD m_dwEventSink;
  315.     DWORD m_dwPropNotifySink;
  316.     DWORD m_dwStyleMask;
  317.     DWORD m_dwStyle;
  318.     DWORD m_dwMiscStatus;
  319.     CONTROLINFO m_ctlInfo;
  320.  
  321. #if !defined(_WIN32_WCE)
  322.     // Databound control stuff
  323.     DWORD m_dwNotifyDBEvents; // INotifyDBEvents sink cookie
  324.     CDataSourceControl* m_pDataSourceControl;
  325.     CDataBoundProperty* m_pBindings;
  326.     union {
  327.         COleControlSite *m_pDSCSite;
  328.         WORD m_ctlidRowSource;
  329.     };
  330.     DISPID m_defdispid;
  331.     UINT m_dwType;
  332.     CString m_strDataField;
  333.     BOOL m_bIgnoreNotify;
  334.     BOOL m_bIsDirty;
  335. #endif // _WIN32_WCE
  336.     VARIANT m_varResult;
  337.  
  338. protected:
  339. // Implementation
  340.     BOOL SetExtent();
  341.     HRESULT CreateOrLoad(REFCLSID clsid, CFile* pPersist, BOOL bStorage,
  342.         BSTR bstrLicKey);
  343.     DWORD ConnectSink(REFIID iid, LPUNKNOWN punkSink);
  344.     void DisconnectSink(REFIID iid, DWORD dwCookie);
  345.     void AttachWindow();
  346.     void DetachWindow();
  347.     BOOL OnEvent(AFX_EVENT* pEvent);
  348.     HRESULT GetCursor(DISPID dispid, LPUNKNOWN* ppcursorOut, LPVOID *ppcidOut);
  349.  
  350. public:
  351. // Interface maps
  352.     BEGIN_INTERFACE_PART(OleClientSite, IOleClientSite)
  353.         INIT_INTERFACE_PART(COleControlSite, OleClientSite)
  354.         STDMETHOD(SaveObject)();
  355.         STDMETHOD(GetMoniker)(DWORD, DWORD, LPMONIKER*);
  356.         STDMETHOD(GetContainer)(LPOLECONTAINER*);
  357.         STDMETHOD(ShowObject)();
  358.         STDMETHOD(OnShowWindow)(BOOL);
  359.         STDMETHOD(RequestNewObjectLayout)();
  360.     END_INTERFACE_PART(OleClientSite)
  361.  
  362.     BEGIN_INTERFACE_PART(OleIPSite, IOleInPlaceSite)
  363.         INIT_INTERFACE_PART(COleControlSite, OleIPSite)
  364.         STDMETHOD(GetWindow)(HWND*);
  365.         STDMETHOD(ContextSensitiveHelp)(BOOL);
  366.         STDMETHOD(CanInPlaceActivate)();
  367.         STDMETHOD(OnInPlaceActivate)();
  368.         STDMETHOD(OnUIActivate)();
  369.         STDMETHOD(GetWindowContext)(LPOLEINPLACEFRAME*,
  370.             LPOLEINPLACEUIWINDOW*, LPRECT, LPRECT, LPOLEINPLACEFRAMEINFO);
  371.         STDMETHOD(Scroll)(SIZE);
  372.         STDMETHOD(OnUIDeactivate)(BOOL);
  373.         STDMETHOD(OnInPlaceDeactivate)();
  374.         STDMETHOD(DiscardUndoState)();
  375.         STDMETHOD(DeactivateAndUndo)();
  376.         STDMETHOD(OnPosRectChange)(LPCRECT);
  377.     END_INTERFACE_PART(OleIPSite)
  378.  
  379.     BEGIN_INTERFACE_PART(OleControlSite, IOleControlSite)
  380.         INIT_INTERFACE_PART(COleControlSite, OleControlSite)
  381.         STDMETHOD(OnControlInfoChanged)();
  382.         STDMETHOD(LockInPlaceActive)(BOOL fLock);
  383.         STDMETHOD(GetExtendedControl)(LPDISPATCH* ppDisp);
  384.         STDMETHOD(TransformCoords)(POINTL* lpptlHimetric,
  385.             POINTF* lpptfContainer, DWORD flags);
  386.         STDMETHOD(TranslateAccelerator)(LPMSG lpMsg, DWORD grfModifiers);
  387.         STDMETHOD(OnFocus)(BOOL fGotFocus);
  388.         STDMETHOD(ShowPropertyFrame)();
  389.     END_INTERFACE_PART(OleControlSite)
  390.  
  391.     BEGIN_INTERFACE_PART(AmbientProps, IDispatch)
  392.         INIT_INTERFACE_PART(COleControlSite, AmbientProps)
  393.         STDMETHOD(GetTypeInfoCount)(unsigned int*);
  394.         STDMETHOD(GetTypeInfo)(unsigned int, LCID, ITypeInfo**);
  395.         STDMETHOD(GetIDsOfNames)(REFIID, LPOLESTR*, unsigned int, LCID, DISPID*);
  396.         STDMETHOD(Invoke)(DISPID, REFIID, LCID, unsigned short, DISPPARAMS*,
  397.                           VARIANT*, EXCEPINFO*, unsigned int*);
  398.     END_INTERFACE_PART(AmbientProps)
  399.  
  400.     BEGIN_INTERFACE_PART(PropertyNotifySink, IPropertyNotifySink)
  401.         INIT_INTERFACE_PART(COleControlSite, PropertyNotifySink)
  402.         STDMETHOD(OnChanged)(DISPID dispid);
  403.         STDMETHOD(OnRequestEdit)(DISPID dispid);
  404.     END_INTERFACE_PART(PropertyNotifySink)
  405.  
  406.     BEGIN_INTERFACE_PART(EventSink, IDispatch)
  407.         INIT_INTERFACE_PART(COleControlSite, EventSink)
  408.         STDMETHOD(GetTypeInfoCount)(unsigned int*);
  409.         STDMETHOD(GetTypeInfo)(unsigned int, LCID, ITypeInfo**);
  410.         STDMETHOD(GetIDsOfNames)(REFIID, LPOLESTR*, unsigned int, LCID, DISPID*);
  411.         STDMETHOD(Invoke)(DISPID, REFIID, LCID, unsigned short, DISPPARAMS*,
  412.                           VARIANT*, EXCEPINFO*, unsigned int*);
  413.     END_INTERFACE_PART(EventSink)
  414.  
  415. #if !defined(_WIN32_WCE)
  416.     BEGIN_INTERFACE_PART(BoundObjectSite, IBoundObjectSite)
  417.         STDMETHOD(GetCursor)(DISPID dispid, LPLPCURSOR ppcursorOut, LPVOID *ppcidOut);
  418.     END_INTERFACE_PART(BoundObjectSite)
  419.  
  420.     BEGIN_INTERFACE_PART(NotifyDBEvents, INotifyDBEvents)
  421.         STDMETHOD(OKToDo)(DWORD dwEventWhat, ULONG cReasons, DBNOTIFYREASON rgReasons[]);
  422.         STDMETHOD(Cancelled)(DWORD dwEventWhat, ULONG cReasons, DBNOTIFYREASON rgReasons[]);
  423.         STDMETHOD(SyncBefore)(DWORD dwEventWhat, ULONG cReasons, DBNOTIFYREASON rgReasons[]);
  424.         STDMETHOD(AboutToDo)(DWORD dwEventWhat, ULONG cReasons, DBNOTIFYREASON rgReasons[]);
  425.         STDMETHOD(FailedToDo)(DWORD dwEventWhat, ULONG cReasons, DBNOTIFYREASON rgReasons[]);
  426.         STDMETHOD(SyncAfter)(DWORD dwEventWhat, ULONG cReasons, DBNOTIFYREASON rgReasons[]);
  427.         STDMETHOD(DidEvent)(DWORD dwEventWhat, ULONG cReasons, DBNOTIFYREASON rgReasons[]);
  428.  
  429.         // Not part of i/f - just a helper
  430.         HRESULT FireEvent(DWORD dwEventWhat, ULONG cReasons,
  431.             DBNOTIFYREASON rgReasons[], DSCSTATE nState);
  432.     END_INTERFACE_PART(NotifyDBEvents)
  433.  
  434.     BEGIN_INTERFACE_PART(RowsetNotify, IRowsetNotify)
  435.         STDMETHOD(OnFieldChange)(IRowset* pRowset, HROW hRow, ULONG cColumns, ULONG rgColumns[], DBREASON eReason, DBEVENTPHASE ePhase, BOOL fCantDeny);
  436.         STDMETHOD(OnRowChange)(IRowset* pRowset, ULONG cRows, const HROW rghRows[], DBREASON eReason, DBEVENTPHASE ePhase, BOOL fCantDeny);
  437.         STDMETHOD(OnRowsetChange)(IRowset* pRowset, DBREASON eReason, DBEVENTPHASE ePhase, BOOL fCantDeny);
  438.     END_INTERFACE_PART(RowsetNotify)
  439. #endif // _WIN32_WCE
  440.  
  441.     DECLARE_INTERFACE_MAP()
  442. };
  443.  
  444. /////////////////////////////////////////////////////////////////////////////
  445. // OLE control container manager
  446.  
  447. class COccManager : public CNoTrackObject
  448. {
  449. // Operations
  450. public:
  451.     // Event handling
  452.     virtual BOOL OnEvent(CCmdTarget* pCmdTarget, UINT idCtrl, AFX_EVENT* pEvent,
  453.         AFX_CMDHANDLERINFO* pHandlerInfo);
  454.  
  455.     // Internal object creation
  456.     virtual COleControlContainer* CreateContainer(CWnd* pWnd);
  457.     virtual COleControlSite* CreateSite(COleControlContainer* pCtrlCont);
  458.  
  459.     // Dialog creation
  460.     virtual const DLGTEMPLATE* PreCreateDialog(_AFX_OCC_DIALOG_INFO* pOccDialogInfo,
  461.         const DLGTEMPLATE* pOrigTemplate);
  462.     virtual void PostCreateDialog(_AFX_OCC_DIALOG_INFO* pOccDialogInfo);
  463.     virtual DLGTEMPLATE* SplitDialogTemplate(const DLGTEMPLATE* pTemplate,
  464.         DLGITEMTEMPLATE** ppOleDlgItems);
  465.     virtual BOOL CreateDlgControls(CWnd* pWndParent, LPCTSTR lpszResourceName,
  466.         _AFX_OCC_DIALOG_INFO* pOccDialogInfo);
  467.     virtual BOOL CreateDlgControls(CWnd* pWndParent, void* lpResource,
  468.         _AFX_OCC_DIALOG_INFO* pOccDialogInfo);
  469.  
  470.     // Dialog manager
  471.     virtual BOOL IsDialogMessage(CWnd* pWndDlg, LPMSG lpMsg);
  472.     static BOOL AFX_CDECL IsLabelControl(CWnd* pWnd);
  473.     static BOOL AFX_CDECL IsMatchingMnemonic(CWnd* pWnd, LPMSG lpMsg);
  474.     static void AFX_CDECL SetDefaultButton(CWnd* pWnd, BOOL bDefault);
  475.     static DWORD AFX_CDECL GetDefBtnCode(CWnd* pWnd);
  476.  
  477. // Implementation
  478. protected:
  479.     // Dialog creation
  480.     HWND CreateDlgControl(CWnd* pWndParent, HWND hwAfter, BOOL bDialogEx,
  481.         LPDLGITEMTEMPLATE pDlgItem, WORD nMsg, BYTE* lpData, DWORD cb);
  482.  
  483.     // Databinding
  484. WCE_DEL void BindControls(CWnd* pWndParent);
  485.  
  486.     // Dialog manager
  487.     static void AFX_CDECL UIActivateControl(CWnd* pWndNewFocus);
  488.     static void AFX_CDECL UIDeactivateIfNecessary(CWnd* pWndOldFocus, CWnd* pWndNewFocus);
  489. };
  490.  
  491. struct _AFX_OCC_DIALOG_INFO
  492. {
  493.     DLGTEMPLATE* m_pNewTemplate;
  494.     DLGITEMTEMPLATE** m_ppOleDlgItems;
  495. #if defined(_WIN32_WCE)
  496. // WinCE: In OCCCONT.CPP, we use this "remembered value" because DLGTEMPLATEEX
  497. // dialogs get converted to DLGTEMPLATE's, but the OLE items are still
  498. // DIGITEMTEMPLATEEX's.
  499.     BOOL m_bDialogEx;
  500. #endif // _WIN32_WCE
  501. };
  502.  
  503. #endif // !_AFX_NO_OCC_SUPPORT
  504.